import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
    nameid: sessionStorage.getItem('nameid')||"" ,
    bjmuiscs:  sessionStorage.getItem('bjmuiscs')||'',
    gamemuiscs: sessionStorage.getItem('gamemuiscs')||'',
    userWallet:''|| sessionStorage.getItem('userWallet'),
    s:''||JSON.parse(sessionStorage.getItem('s')),
    usdt:sessionStorage.getItem('usdt')||'0',
    dot:sessionStorage.getItem('dot')||'0',
    language:localStorage.getItem('yy')||'',
    ttou:sessionStorage.getItem('ttou')||'',
    utoc:sessionStorage.getItem('utoc')||'',
    ttoc:sessionStorage.getItem('ttoc')||'',
    see:sessionStorage.getItem('see')||'1',


  },
  mutations: {
    editbjmuiscs(state, val) {
      state.bjmuiscs = val
      sessionStorage.setItem('bjmuiscs', val)
    },
    editgamemuiscs(state, val) {
      state.gamemuiscs = val
      sessionStorage.setItem('gamemuiscs', val)
    },
    nameid(state, val) {
      state.nameid = val
      sessionStorage.getItem('nameid')
    },
    userWallet(state,val){
      state.userWallet = val
      sessionStorage.setItem('userWallet', val)
    },
    usdt(state,val){
      state.usdt = val
      sessionStorage.setItem('usdt', val)
    },
    dot(state,val){
      state.dot = val
      sessionStorage.setItem('dot', val)
    },
    language(state,val){
      state.language = val
      localStorage.setItem('yy', val)
    },
    ttou(state,val){
      state.ttou = val
      sessionStorage.setItem('ttou', val)
    },
    utoc(state,val){
      state.utoc = val
      sessionStorage.setItem('utoc', val)
    },
    ttoc(state,val){
      state.ttoc = val
      sessionStorage.setItem('ttoc', val)
    },
    see(state,val){
      state.see = val
      sessionStorage.setItem('see', val)
    },
    s(state,val){
      state.s = val
      sessionStorage.setItem('s', JSON.stringify(val))
    }

  },
  getters: {
    bjmuiscs: (state) => state.bjmuiscs,
    gamemuiscs: (state) => state.gamemuiscs,
    nameid: (state) => state.nameid,
    userWallet: (state)=>state.userWallet,
    usdt: (state)=>state.usdt,
    dot: (state)=>state.dot,
    language: (state)=>state.language,
    ttou: (state)=>state.ttou,
    utoc: (state)=>state.utoc,
    ttoc: (state)=>state.ttoc,
    see: (state)=>state.see,
    s: (state)=>state.s,
  }
})

export default store
